﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
using System.Xml;
using Cofe.Core;
using Cofe.Core.Filter;
using Cofe.Core.Implements;

namespace Cofe.Web
{
    ///// <summary>
    ///// Called by entry (CofeSystemInfo) when it's IXmlSerializable.ReadXml/WriteXml() is called.
    ///// </summary>
    public interface IEntryXmlSerializer : ICofeService
    {        
        void WriteXml<T>(T entry, XmlWriter writer, bool IncludeDetails = false) where T : CofeSystemInfo;
        void WriteXml(IEnumerable<CofeSystemInfo> subEntries, XmlWriter writer, bool IncludeDetails = false);
        //void WriteXml<T>(T directory, XmlWriter writer, FilterCollections filters, bool IncludeDetails = false) where T : CofeDirectoryInfo;

        void WriteParameters(ParameterDic pd, SerializationInfo info, StreamingContext context, Func<string, string> parameterFilter = null);
        void WriteObjectData<T>(T entry, SerializationInfo info, StreamingContext context, bool IncludeDetails = false) where T : CofeSystemInfo;
        void WriteObjectData(IEnumerable<CofeSystemInfo> subEntries, ParameterDic pd, SerializationInfo info, 
            StreamingContext context, bool IncludeDetails = false);

        bool ReadObjectData<T>(SerializationInfo info, StreamingContext context, out T entry) where T : CofeSystemInfo;
        bool ReadObjectData(SerializationInfo info, StreamingContext context, out IEnumerable<CofeSystemInfo> subEntries, 
            out ParameterDic pd);
    }
   
}
